package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	server := gin.Default()
	server.GET("/hello", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "hello_gin",
		})
	})
	server.GET("/path/:name", func(ctx *gin.Context) {
		name := ctx.Param("name")
		ctx.String(http.StatusOK, name)
	})
	server.GET("/page/*.html", func(ctx *gin.Context) {
		html := ctx.Param(".html")
		ctx.String(http.StatusOK, "你访问的是"+html)
	})
	server.GET("/ques", func(ctx *gin.Context) {
		id := ctx.Query("id")
		ctx.String(http.StatusOK, "你的ID的"+id)
	})

	server.Run(":9999") // 监听并在 0.0.0.0:8080 上启动服务
}
